﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using HNCDataSetTableAdapters;

public partial class UserControl_menu : System.Web.UI.UserControl
{
    CategoryTableAdapter cate = new CategoryTableAdapter();
    ProductsTableAdapter pro = new ProductsTableAdapter();
    InfoTableAdapter info = new InfoTableAdapter();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            yahoo();
            skype();
            loadfooter();

            DataTable dt = pro.GetProductByCateID(12);
            string ProductID = dt.Rows[0]["ProductID"].ToString();
            tailieu.HRef = "~/tai-lieu-ky-thuat-" + ProductID + ".html";
        }
    }

    public void loadfooter()
    {
        DataTable dt = info.GetInfoByID(1);

        lblHotline.Text = dt.Rows[0]["Hotline"].ToString();
        txtImage.ImageUrl = "~/UserUploads/Banner/" + dt.Rows[0]["Image"].ToString();
    }
    public void yahoo()
    {
        DataTable dt = info.GetInfoByID(1);
        string yahoo = dt.Rows[0]["Yahoo1"].ToString();
        string tem = "";

        tem += "<a class='yahoo' href='ymsgr:sendim?" + yahoo + @"'>";
        tem += "<img src=\"img/yahoo.png\" alt=\"yahoo\" />";
        tem += "</a>";

        ltryahoo.Text = tem;
    }

    public void skype()
    {
        DataTable dt = info.GetInfoByID(1);
        string Skype = dt.Rows[0]["Skype1"].ToString();
        string tem = "";

        tem += "<a href='skype:" + Skype + @"?chat'>";
        tem += "<img style=\"border: none;\" src=\"img/skype.png\" alt=\"skype\" />";
        tem += "</a>";

        ltrskype.Text = tem;
    }

    protected void setLanguage(object sender, EventArgs e)
    {
        Session["language"] = ((LinkButton)sender).ToolTip;
        Response.Redirect(Request.RawUrl);
    }
}